# -*- encoding: utf-8 -*-
"""
@File    :   constant.py
@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2024/7/10 16:40   yudejun      1.0         None
"""

# base pkgs
import os
from enum import Enum

# customized pkgs
from utils.base_path import get_base_path

class InitVar(float, Enum):
    cfl = 0.01

class MeshMode(int, Enum):
    uniform = 1  # 均匀网格

class DifferenceMode(int, Enum):
    CDMs = 1  # 单步长中心差分
    CDMd = 2  # 双步长中心差分
    FOU = 3  # 迎风格式
    MinMod = 4

class InterpMode(int, Enum):
    MID = 1  # 中心插值
    FOU = 2  # 迎风格式


class ExtrapMode(int, Enum):
    MIDin_linearB = 1  # 中心插值


class FlowPatternID(int, Enum):
    """流型判别"""

    StratifiedFlow = 1  # 分层流
    AnnularFlow = 2  # 环状流
    SlugFlow = 3   # 段塞流
    BubbleFlow = 4  # 泡状流

class FlowPatternMode(Enum):
    NoneFlowPattern = False #用于simple测试中无流型
    HaveFlowPattern = True #用于simple测试中有流型



class Physics(float, Enum):
    R_D = 1
    g = 9.8


class BoundaryConditionType(int, Enum):
    # faucet = 0  # 水龙头算例边界
    inlet_M_outlet_p = 1  # 入口定流，出口定压
    inlet_p_outlet_M = 2   # 入口定压，出口定流
    inlet_p_outlet_p = 3  # 入口定压，出口定压


class PiplengthXHInputClass(int, Enum):
    # 输入管长 里程 高程的形式
    Segment = 1 # 分段式 [100, 1000, 100] 表示第一段100，第二段1000，第三段100
    Coordinate = 2 # 坐标式 [0, 1000, 1100] 表示第一位置是0，第二位置1000，第三位置1100



class FluidType(int, Enum):
    BlackOil = 1  # 黑油
    Compositional = 2  # 组分
    PVT = 3  # pvt
    TAB = 4  # tab
    
# class FlowPattern(int, Enum):
#     # 分离流
#     FLOW_TYPE_SEPARATED = 1
#     # 过渡流
#     FLOW_TYPE_TRANSITION = 2
#     # 间歇流
#     FLOW_TYPE_SLUGGING = 3
#     # 分散流
#     FLOW_TYPE_DISPERSED = 4



class SourceMode(int, Enum):
    QuasiSteady = 1
    SmallInclinedPipe = 2


class FlowType(int, Enum):
    LiquidFlowrate = 1
    GasFlowrate = 2
    MassFlowrate = 3


class CorrelationType(int, Enum):
    Beggs_Brill = 1  # 'Beggs & Brill Original'
    Mukherjee_Brill = 2  # 'Mukherjee Brill'
    Beggs_Taitel_Dukler = 3
    No_Slip = 4
    Hughmark_Dukler = 5
    TranSim_Two_Phase = 6

class SingleCorrelationType(int, Enum):
    Moody = 1
    AGA = 2


class FluidPhaseType(int, Enum):
    Oil = 1  # ///< 表示单相油。
    Gas = 2  # ///< 表示单相气。
    Water = 3  # ///< 表示单相水。
    Oil_Water = 4  # ///< 表示为油水混合物的液相。
    Oil_Gas = 5  # 表示为油气两相的多相。
    Water_Gas = 6  # 表示为水气两相的多相流。
    Tri_phase = 7  # < 表示为水气油三相的多相流。


class HeatConductivity(float, Enum):
    # 单位：W/ (m·K)
    Oil = 0.138
    Water = 0.605
    Gas = 0.035


class TabParams():
    # 算法中用到的tab物性参数缩写与完整变量名的对应关系大全
    name = [
        'PT',           # pressure                                   压力 Pa
        'TM',           # temperature                                温度 ℃
        'ROG',          # gas_density                               气相密度 kg/m3
        'ROHL',         # oil_density                               油相密度 kg/m3
        'ROWT',         # water_density                             水相密度 kg/m3
        'DROGDP',       # derivative_of_gas_density_w.r.t_pressure        气相密度随压力的偏导 s2/m2
        'DROHLDP',      # derivative_of_oil_density_w.r.t_pressure        油相密度随压力的偏导 s2/m3
        'DROWTDP',      # derivative_of_water_density_w.r.t_pressure      水相密度随压力的偏导 s2/m4
        'DROGDT',       # derivative_of_gas_density_w.r.t_temperature     气相密度随温度的偏导 kg/m3.k
        'DROHLDT',      # derivative_of_oil_density_w.r.t_temperature     油相密度随温度的偏导 kg/m3.k
        'DROWTDT',      # derivative_of_water_density_w.r.t_temperature   水相密度随温度的偏导 kg/m3.k
        'RS',           # gas_mass_fraction_in_gas/oil_mixture           烃类中气相质量分数 /
        'RSW',          # water_vapour_mass_fraction_in_gas_phase       气相中水蒸气的质量分数 /
        'VISG',         # gas_viscosity                            气相粘度 Pa.s
        'VISHL',        # oil_viscosity                            油相粘度 Pa.s
        'VISWT',        # water_viscosity                          水相粘度 Pa.s
        'CPG',          # gas_thermal_capacity                     气相比热容 J/kg.℃
        'CPHL',         # oil_thermal_capacity                     油相比热容 J/kg.℃
        'CPWT',         # water_thermal_capacity                   水相比热容 J/kg.℃
        'HG',           # gas_enthalpy                             气相焓值 J/kg
        'HHL',          # oil_enthalpy                             油相焓值 J/kg
        'HWT',          # water_enthalpy                           水相焓值 J/kg
        'TCG',          # gas_thermal_conductivity                 气相导热系数 w/m.C
        'TCHL',         # oil_thermal_conductivity                 油相导热系数 w/m.C
        'TCWT',         # water_thermal_conductivity               水相导热系数 w/m.C
        'SIGGHL',       # surface_tension_between_gas_and_oil      气油界面张力 N/m
        'SIGGWT',       # surface_tension_between_gas_and_water    气水界面张力 N/m
        'SIGHLWT',      # surface_tension_between_oil_and_water    油水界面张力 N/m
        'SEG',          # gas_entropy                              气相熵值 J/kg.k
        'SEHL',         # oil_entropy                              油相熵值 J/kg.k
        'SEWT',         # water_entropy                            水相熵值 J/kg.k
    ]





